package com.frxuexi.mdm2206

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import com.frxuexi.apps.AppsPage
import com.frxuexi.document.view.DocPage
import com.frxuexi.document.view.LocalPage
import com.frxuexi.mine.view.MinePage
import com.frxuexi.lib_base.RoutePath
import com.frxuexi.mdm2206.view.HomePage
import com.frxuexi.mdm2206.view.MessagePage
import com.frxuexi.mine.view.ApproveLeave
import com.frxuexi.mine.view.AskLeavePage
import com.frxuexi.mine.view.ComLeave
import com.frxuexi.mine.view.LeaveDetailPage
import com.frxuexi.mine.view.LeaveListPage
import com.frxuexi.mine.view.LoginPage
import com.frxuexi.mine.view.RegisterPage
import com.frxuexi.myroom.view.ComView
import com.frxuexi.myroom.view.LoginView
import com.frxuexi.myroom.view.MyPage
import com.frxuexi.myroom.view.RegisterView
import com.frxuexi.myroom.view.RoomApproveLeave
import com.frxuexi.myroom.view.RoomLeaveListPage
import com.frxuexi.myroom.view.RoomLeavePage
import com.frxuexi.report.view.ReportListPage
import com.frxuexi.report.view.ReportPage
import com.frxuexi.sign.view.SignListPage
import com.frxuexi.sign.view.SignPage

@Composable
fun MyNavHost(navHostController: NavHostController,it:PaddingValues) {
    NavHost(
        navController = navHostController,
        startDestination = RoutePath.HOME,
        modifier = androidx.compose.ui.Modifier.padding(it),
        builder = {
            composable(RoutePath.MASSAGE) { MessagePage() }
            composable(RoutePath.HOME) { HomePage(navHostController) }
            composable(RoutePath.MINE) { MinePage(navHostController) }
            composable(RoutePath.APPS) { AppsPage(navHostController) }
            composable(RoutePath.DOC) { DocPage(navHostController) }
            composable(RoutePath.LOCAL) { LocalPage(navHostController) }
            composable(RoutePath.REPORTLIST) { ReportListPage(navHostController) }
            composable(RoutePath.REPORT+"/{report}") {
                val json = it.arguments?.getString("report", "").toString()
                ReportPage(navHostController,json) }
            composable(RoutePath.SIGNLIST) { SignListPage(navHostController) }
            composable(RoutePath.SIGN) { SignPage(navHostController) }
            composable(RoutePath.REGISTER) { RegisterPage(navHostController) }
            composable(RoutePath.LOGIN) { LoginPage(navHostController) }
            composable(RoutePath.LEAVELIST) { LeaveListPage(navHostController) }
            composable(RoutePath.ASKLEAVE) { AskLeavePage(navHostController) }
            composable(RoutePath.APPROVELEAVE) { ApproveLeave(navHostController) }
            composable(RoutePath.COMLEAVE+"/{leave}") {
                val json = it.arguments?.getString("leave", "").toString()
                ComLeave(navHostController,json)
            }
            composable(RoutePath.LEAVEDETAIL+"/{leave}") {
                val json = it.arguments?.getString("leave", "").toString()
                LeaveDetailPage(navHostController,json) }
            composable(RoutePath.ROOMREGISTER) { RegisterView(navHostController) }
            composable(RoutePath.ROOMLOGIN) { LoginView(navHostController) }
            composable(RoutePath.MY) { MyPage(navHostController) }
            composable(RoutePath.ROOMLEAVELIST) { RoomLeaveListPage(navHostController) }
            composable(RoutePath.ROOMLEAVE) { RoomLeavePage(navHostController) }
            composable(RoutePath.ROOMAPPROVELEAVE) { RoomApproveLeave(navHostController) }
            composable(RoutePath.ROOMCOM+"/{leave}") {
                val json = it.arguments?.getString("leave", "").toString()
                ComView(navHostController,json) }
        })
}